import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'home',
    component: HomeView,
  },
  {
    path: '/my',
    name: 'my',
    component: () => import('../views/MyView.vue')
  },
  {
    path: '/bookshelf',
    name: 'bookshelf',
    component: () => import('../views/BookshelfView.vue')
  },
  {
    path: '/sort',
    name: 'sort',
    component: () => import('../views/SortView.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/SearchView.vue'),
    meta: {
      hideNav: true,
    }
  },
  {
    path: '/all/:allid/:allname',
    name: 'all',
    props: true,
    component: () => import('@/views/AllView.vue'),
    meta: {
      hideNav: true,
    }
  },
  {
    path: '/details/:detailsid',
    name: 'details',
    props: true,
    component: () => import('@/views/DetailsView.vue'),
    meta: {
      hideNav: true,
    }
  },
  {
    path: '/content/:contentid/:detailsid',
    name: 'content',
    props: true,
    component: () => import('@/views/ContentView.vue'),
    meta: {
      hideNav: true,
    }
  },


]

const router = new VueRouter({
  mode: 'hash',
  // mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior() {
    return { x: 0 };
  },
  routes
})


export default router